	.file	1 "tp0.c"
	.section .mdebug.abi32
	.previous
	.abicalls
	.globl	pcoutputfile
	.globl	pcoutputfile
	.section	.bss
	.align	2
	.type	pcoutputfile, @object
	.size	pcoutputfile, 4
pcoutputfile:
	.space	4
	.local	bspecoutput_opt
	.comm	bspecoutput_opt,2,2
	.local	bresolution_opt
	.comm	bresolution_opt,2,2
	.local	bout_is_stdout
	.comm	bout_is_stdout,2,2
	.data
	.align	2
	.type	image_size, @object
	.size	image_size, 8
image_size:
	.word	8
	.word	8
	.text
	.align	2
	.ent	clean_exit
clean_exit:
	.frame	$fp,48,$ra		# vars= 8, regs= 3/0, args= 16, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,48
	.cprestore 16
	sw	$ra,40($sp)
	sw	$fp,36($sp)
	sw	$gp,32($sp)
	move	$fp,$sp
	sw	$a0,48($fp)
	move	$v0,$a1
	sh	$v0,24($fp)
	lhu	$v0,24($fp)
	beq	$v0,$zero,$L18
	lw	$a0,48($fp)
	la	$t9,messageerror
	jal	$ra,$t9
$L18:
	lw	$v0,pcoutputfile
	beq	$v0,$zero,$L19
	lhu	$v0,bout_is_stdout
	bne	$v0,$zero,$L19
	lw	$v0,48($fp)
	beq	$v0,$zero,$L19
	lw	$a0,pcoutputfile
	la	$t9,remove
	jal	$ra,$t9
$L19:
	lw	$a0,48($fp)
	la	$t9,exit
	jal	$ra,$t9
	.end	clean_exit
	.size	clean_exit, .-clean_exit
	.rdata
	.align	2
$LC0:
	.ascii	"version\000"
	.align	2
$LC1:
	.ascii	"help\000"
	.align	2
$LC2:
	.ascii	"output\000"
	.align	2
$LC3:
	.ascii	"resolution\000"
	.data
	.align	2
$LC4:
	.word	$LC0
	.word	0
	.word	0
	.word	86
	.word	$LC1
	.word	0
	.word	0
	.word	104
	.word	$LC2
	.word	1
	.word	0
	.word	111
	.word	$LC3
	.word	1
	.word	0
	.word	114
	.word	0
	.word	0
	.word	0
	.word	0
	.globl	memcpy
	.rdata
	.align	2
$LC5:
	.ascii	":Vho:r:\000"
	.align	2
$LC6:
	.ascii	"Using default resolution: \"8x8\".\n\000"
	.align	2
$LC7:
	.ascii	"Using default output: \"stdout\".\n\000"
	.text
	.align	2
	.ent	parse_cmdline
parse_cmdline:
	.frame	$fp,144,$ra		# vars= 96, regs= 3/0, args= 24, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,144
	.cprestore 24
	sw	$ra,136($sp)
	sw	$fp,132($sp)
	sw	$gp,128($sp)
	move	$fp,$sp
	sw	$a0,144($fp)
	sw	$a1,148($fp)
	sw	$zero,36($fp)
	addu	$v0,$fp,40
	la	$v1,$LC4
	move	$a0,$v0
	move	$a1,$v1
	li	$a2,80			# 0x50
	la	$t9,memcpy
	jal	$ra,$t9
	sw	$zero,opterr
	sw	$zero,36($fp)
$L21:
	addu	$v1,$fp,40
	addu	$v0,$fp,36
	sw	$v0,16($sp)
	lw	$a0,144($fp)
	lw	$a1,148($fp)
	la	$a2,$LC5
	move	$a3,$v1
	la	$t9,getopt_long
	jal	$ra,$t9
	sw	$v0,32($fp)
	lw	$v1,32($fp)
	li	$v0,-1			# 0xffffffffffffffff
	bne	$v1,$v0,$L23
	b	$L22
$L23:
	lw	$v0,32($fp)
	addu	$v0,$v0,-58
	sw	$v0,120($fp)
	lw	$v1,120($fp)
	sltu	$v0,$v1,57
	beq	$v0,$zero,$L31
	lw	$v0,120($fp)
	sll	$v1,$v0,2
	la	$v0,$L32
	addu	$v0,$v1,$v0
	lw	$v0,0($v0)
	.cpadd	$v0
	j	$v0
	.rdata
	.align	2
$L32:
	.gpword	$L30
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L29
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L25
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L26
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L31
	.gpword	$L27
	.gpword	$L31
	.gpword	$L31
	.gpword	$L28
	.text
$L25:
	lw	$v0,148($fp)
	lw	$a0,0($v0)
	la	$t9,do_version
	jal	$ra,$t9
	b	$L21
$L26:
	lw	$v0,148($fp)
	lw	$a0,0($v0)
	move	$a1,$zero
	la	$t9,do_usage
	jal	$ra,$t9
	b	$L21
$L27:
	lw	$v0,148($fp)
	lw	$a0,0($v0)
	lw	$a1,optarg
	la	$t9,do_output
	jal	$ra,$t9
	b	$L21
$L28:
	lw	$v0,148($fp)
	lw	$a0,0($v0)
	lw	$a1,optarg
	la	$t9,do_resolution
	jal	$ra,$t9
	b	$L21
$L29:
	lw	$v0,148($fp)
	lw	$a0,0($v0)
	li	$a1,3			# 0x3
	la	$t9,do_usage
	jal	$ra,$t9
$L30:
	lw	$v0,148($fp)
	lw	$a0,0($v0)
	li	$a1,2			# 0x2
	la	$t9,do_usage
	jal	$ra,$t9
$L31:
	lw	$v0,148($fp)
	lw	$a0,0($v0)
	li	$a1,3			# 0x3
	la	$t9,do_usage
	jal	$ra,$t9
	b	$L21
$L22:
	lw	$v0,optind
	lw	$v1,144($fp)
	slt	$v0,$v0,$v1
	beq	$v0,$zero,$L33
	li	$a0,3			# 0x3
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L33:
	lhu	$v0,bresolution_opt
	bne	$v0,$zero,$L34
	la	$a0,$LC6
	la	$t9,messageinfo
	jal	$ra,$t9
$L34:
	lhu	$v0,bspecoutput_opt
	bne	$v0,$zero,$L20
	la	$a0,$LC7
	la	$t9,messageinfo
	jal	$ra,$t9
$L20:
	move	$sp,$fp
	lw	$ra,136($sp)
	lw	$fp,132($sp)
	addu	$sp,$sp,144
	j	$ra
	.end	parse_cmdline
	.size	parse_cmdline, .-parse_cmdline
	.rdata
	.align	2
$LC8:
	.ascii	"\n"
	.ascii	"Usage:\n\n"
	.ascii	"\t%s -V\n"
	.ascii	"\t%s -h\n"
	.ascii	"\t%s [options]\n\n"
	.ascii	"Options:\n\n\000"
	.align	2
$LC9:
	.ascii	"\t-V, --version\t\tPrint version and quit.\n"
	.ascii	"\t-h, --help\t\tPrint this information.\n"
	.ascii	"\t-r, --resolution\tSet bitmap resolution to WxH pixels."
	.ascii	"\n\n"
	.ascii	"\t-o, --output\t\tPath to output file.\n\000"
	.align	2
$LC10:
	.ascii	"Examples:\n\n"
	.ascii	"\t%s -o output.pgm\n"
	.ascii	"\t%s -r 800x600 -o file.pgm\n\n\000"
	.text
	.align	2
	.ent	do_usage
do_usage:
	.frame	$fp,48,$ra		# vars= 0, regs= 3/0, args= 24, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,48
	.cprestore 24
	sw	$ra,40($sp)
	sw	$fp,36($sp)
	sw	$gp,32($sp)
	move	$fp,$sp
	sw	$a0,48($fp)
	sw	$a1,52($fp)
	lw	$v0,52($fp)
	beq	$v0,$zero,$L37
	lw	$a0,52($fp)
	la	$t9,messageerror
	jal	$ra,$t9
$L37:
	lw	$v0,48($fp)
	sw	$v0,16($sp)
	la	$a0,__sF+176
	la	$a1,$LC8
	lw	$a2,48($fp)
	lw	$a3,48($fp)
	la	$t9,fprintf
	jal	$ra,$t9
	la	$a0,__sF+176
	la	$a1,$LC9
	la	$t9,fprintf
	jal	$ra,$t9
	la	$a0,__sF+176
	la	$a1,$LC10
	lw	$a2,48($fp)
	lw	$a3,48($fp)
	la	$t9,fprintf
	jal	$ra,$t9
	lw	$a0,52($fp)
	move	$a1,$zero
	la	$t9,clean_exit
	jal	$ra,$t9
	move	$sp,$fp
	lw	$ra,40($sp)
	lw	$fp,36($sp)
	addu	$sp,$sp,48
	j	$ra
	.end	do_usage
	.size	do_usage, .-do_usage
	.rdata
	.align	2
$LC11:
	.ascii	"TP0 66.20 version: %s\n\000"
	.align	2
$LC12:
	.ascii	"0.8.0\000"
	.text
	.align	2
	.ent	do_version
do_version:
	.frame	$fp,40,$ra		# vars= 0, regs= 3/0, args= 16, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,40
	.cprestore 16
	sw	$ra,32($sp)
	sw	$fp,28($sp)
	sw	$gp,24($sp)
	move	$fp,$sp
	sw	$a0,40($fp)
	la	$a0,__sF+176
	la	$a1,$LC11
	la	$a2,$LC12
	la	$t9,fprintf
	jal	$ra,$t9
	move	$a0,$zero
	move	$a1,$zero
	la	$t9,clean_exit
	jal	$ra,$t9
	move	$sp,$fp
	lw	$ra,32($sp)
	lw	$fp,28($sp)
	addu	$sp,$sp,40
	j	$ra
	.end	do_version
	.size	do_version, .-do_version
	.align	2
	.ent	do_output
do_output:
	.frame	$fp,40,$ra		# vars= 0, regs= 3/0, args= 16, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,40
	.cprestore 16
	sw	$ra,32($sp)
	sw	$fp,28($sp)
	sw	$gp,24($sp)
	move	$fp,$sp
	sw	$a0,40($fp)
	sw	$a1,44($fp)
	lw	$v0,44($fp)
	beq	$v0,$zero,$L41
	lw	$v0,44($fp)
	lb	$v0,0($v0)
	bne	$v0,$zero,$L40
$L41:
	li	$a0,5			# 0x5
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L40:
	lhu	$v0,bspecoutput_opt
	beq	$v0,$zero,$L42
	li	$a0,7			# 0x7
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L42:
	lw	$v0,44($fp)
	sw	$v0,pcoutputfile
	li	$v0,1			# 0x1
	sh	$v0,bspecoutput_opt
	move	$sp,$fp
	lw	$ra,32($sp)
	lw	$fp,28($sp)
	addu	$sp,$sp,40
	j	$ra
	.end	do_output
	.size	do_output, .-do_output
	.align	2
	.ent	do_resolution
do_resolution:
	.frame	$fp,40,$ra		# vars= 0, regs= 3/0, args= 16, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,40
	.cprestore 16
	sw	$ra,32($sp)
	sw	$fp,28($sp)
	sw	$gp,24($sp)
	move	$fp,$sp
	sw	$a0,40($fp)
	sw	$a1,44($fp)
	lw	$v0,44($fp)
	beq	$v0,$zero,$L45
	lw	$v0,44($fp)
	lb	$v0,0($v0)
	bne	$v0,$zero,$L44
$L45:
	li	$a0,5			# 0x5
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L44:
	lhu	$v0,bresolution_opt
	beq	$v0,$zero,$L46
	li	$a0,8			# 0x8
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L46:
	la	$a0,image_size
	lw	$a1,44($fp)
	la	$t9,parse_image_size
	jal	$ra,$t9
	bne	$v0,$zero,$L47
	li	$a0,4			# 0x4
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L47:
	li	$v0,1			# 0x1
	sh	$v0,bresolution_opt
	move	$sp,$fp
	lw	$ra,32($sp)
	lw	$fp,28($sp)
	addu	$sp,$sp,40
	j	$ra
	.end	do_resolution
	.size	do_resolution, .-do_resolution
	.align	2
	.globl	parse_image_size
	.ent	parse_image_size
parse_image_size:
	.frame	$fp,56,$ra		# vars= 16, regs= 3/0, args= 16, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,56
	.cprestore 16
	sw	$ra,48($sp)
	sw	$fp,44($sp)
	sw	$gp,40($sp)
	move	$fp,$sp
	sw	$a0,56($fp)
	sw	$a1,60($fp)
	sw	$zero,28($fp)
	sw	$zero,32($fp)
	lw	$v0,60($fp)
	beq	$v0,$zero,$L50
	lw	$v0,60($fp)
	lb	$v0,0($v0)
	bne	$v0,$zero,$L49
$L50:
	sw	$zero,36($fp)
	b	$L48
$L49:
	lw	$a0,60($fp)
	addu	$a1,$fp,24
	li	$a2,10			# 0xa
	la	$t9,strtol
	jal	$ra,$t9
	sw	$v0,28($fp)
	lw	$v0,24($fp)
	lb	$v0,0($v0)
	beq	$v0,$zero,$L51
	lw	$v0,24($fp)
	lb	$v1,0($v0)
	li	$v0,120			# 0x78
	beq	$v1,$v0,$L52
	sw	$zero,36($fp)
	b	$L48
$L52:
	lw	$v0,24($fp)
	addu	$v0,$v0,1
	sw	$v0,24($fp)
$L51:
	lw	$a0,24($fp)
	addu	$a1,$fp,24
	li	$a2,10			# 0xa
	la	$t9,strtol
	jal	$ra,$t9
	sw	$v0,32($fp)
	lw	$v0,24($fp)
	lb	$v0,0($v0)
	beq	$v0,$zero,$L53
	sw	$zero,36($fp)
	b	$L48
$L53:
	lw	$v0,28($fp)
	blez	$v0,$L55
	lw	$v0,32($fp)
	blez	$v0,$L55
	b	$L54
$L55:
	sw	$zero,36($fp)
	b	$L48
$L54:
	lw	$v0,28($fp)
	andi	$v0,$v0,0x7
	bne	$v0,$zero,$L57
	lw	$v0,32($fp)
	andi	$v0,$v0,0x7
	bne	$v0,$zero,$L57
	b	$L56
$L57:
	sw	$zero,36($fp)
	b	$L48
$L56:
	lw	$v1,56($fp)
	lw	$v0,28($fp)
	sw	$v0,0($v1)
	lw	$v1,56($fp)
	lw	$v0,32($fp)
	sw	$v0,4($v1)
	li	$v0,1			# 0x1
	sw	$v0,36($fp)
$L48:
	lw	$v0,36($fp)
	move	$sp,$fp
	lw	$ra,48($sp)
	lw	$fp,44($sp)
	addu	$sp,$sp,56
	j	$ra
	.end	parse_image_size
	.size	parse_image_size, .-parse_image_size
	.rdata
	.align	2
$LC13:
	.ascii	"-\000"
	.align	2
$LC14:
	.ascii	"<Standard output>\000"
	.align	2
$LC15:
	.ascii	"w\000"
	.text
	.align	2
	.globl	main
	.ent	main
main:
	.frame	$fp,56,$ra		# vars= 16, regs= 3/0, args= 16, extra= 8
	.mask	0xd0000000,-8
	.fmask	0x00000000,0
	.set	noreorder
	.cpload	$t9
	.set	reorder
	subu	$sp,$sp,56
	.cprestore 16
	sw	$ra,48($sp)
	sw	$fp,44($sp)
	sw	$gp,40($sp)
	move	$fp,$sp
	sw	$a0,56($fp)
	sw	$a1,60($fp)
	sw	$a2,64($fp)
	lw	$a0,56($fp)
	lw	$a1,60($fp)
	la	$t9,parse_cmdline
	jal	$ra,$t9
	sh	$zero,32($fp)
	lhu	$v0,bspecoutput_opt
	beq	$v0,$zero,$L60
	lw	$a0,pcoutputfile
	la	$a1,$LC13
	la	$t9,strcmp
	jal	$ra,$t9
	bne	$v0,$zero,$L59
$L60:
	li	$v0,1			# 0x1
	sh	$v0,32($fp)
$L59:
	lhu	$v0,32($fp)
	sh	$v0,bout_is_stdout
	lhu	$v0,bout_is_stdout
	beq	$v0,$zero,$L61
	la	$v0,__sF+88
	sw	$v0,24($fp)
	la	$v0,$LC14
	sw	$v0,pcoutputfile
	b	$L62
$L61:
	lw	$v0,pcoutputfile
	sw	$v0,pprocfilename
	lw	$a0,pcoutputfile
	la	$a1,$LC15
	la	$t9,fopen
	jal	$ra,$t9
	sw	$v0,24($fp)
	lw	$v0,24($fp)
	bne	$v0,$zero,$L62
	li	$a0,13			# 0xd
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L62:
	la	$a0,image_size
	lw	$a1,24($fp)
	la	$t9,generate_pgm_board_image
	jal	$ra,$t9
	sw	$v0,28($fp)
	lhu	$v0,bout_is_stdout
	bne	$v0,$zero,$L64
	lw	$a0,24($fp)
	la	$t9,fclose
	jal	$ra,$t9
$L64:
	lw	$v0,28($fp)
	beq	$v0,$zero,$L65
	lw	$a0,28($fp)
	li	$a1,1			# 0x1
	la	$t9,clean_exit
	jal	$ra,$t9
$L65:
	lw	$a0,28($fp)
	la	$t9,messageerror
	jal	$ra,$t9
	lw	$v0,28($fp)
	move	$sp,$fp
	lw	$ra,48($sp)
	lw	$fp,44($sp)
	addu	$sp,$sp,56
	j	$ra
	.end	main
	.size	main, .-main

	.comm	pprocfilename,4
	.ident	"GCC: (GNU) 3.3.3 (NetBSD nb3 20040520)"
